<template>
  <div>
    Child: {{money}}

    <button @click="huaqian">花钱</button>
  </div>
</template>

<script>
export default {
  props: {
    money: {
      type: Number,
      default: 10
    }
  },
  setup (props, context) {
    // context.emit => Vue2 this.$emit
    const huaqian = () => {
      // !#1 儿子通过 $emit 触发父亲自定义事件的同时并传参
      context.emit('updateMoney', 2)
    }

    return {huaqian}
  }
}
</script>

<style lang="scss" scoped>

</style>